def test():
    i = 0
    while i < 5:
        temp = yield i
        print(temp)
        i += 1


t = test()

# 测试一  直接报错
# t.send("haha")


# 测试二  要先next再send
print(t.__next__())
t.send("ywc")
print("----2----")



# 测试三
t = test()
print(t.__next__())
t.send(None)  # 传none可以
print("----3----")

# 测试四
# t = test()
# print(t.__next__())
# t.send()  # 不能传空值
# print("----2----")